{extend name="layouts@base" /}
{block name="head"}
<link rel="stylesheet" href="__STATIC__/mobile/default/css/userData.css"/>
{/block}

{block name="main" }
<form id="alipay_from">
<div class="page-bd">
  <!-- 页面内容-->
        <div class="cells">
          <div class="cell">
            <div class="cell_hd"><span class="fs28 color_3 fw_b">账户姓名</span></div>  
            <div class="cell_bd">     
                <input type="text" class="fs28  color_3" name="alipay_user_name" placeholder="请输入账户姓名">
            </div>

          </div>
          <div class="cell">
              <div class="cell_hd"><span class="fs28 color_3 fw_b">支付宝账号</span></div>  
            <div class="cell_bd">
                <input type="text" class="fs28  color_3" name="alipay_account" placeholder="请输入支付宝账号">
            </div>
          </div>
          <div class="cell cell_auto" style="height: 1.2rem;">
		        <div class="cell_hd"><span class="fs28 color_3 fw_b">收款二维码</span></div>
		        <div class="cell_bd">
		          <div class="uploader">
		            <img src="" alt="" class="userimg" style="position: absolute;z-index: 1;max-width: 100%;max-height: 100%;">
		            <input type="file" accept="image/jpeg,image/jpg,image/png" class="uploadInput" onchange="uploadFile(this,event)"
		              style="width:100%;height:100%;opacity:0;">
		          </div>
		        </div>
		      </div>
        </div> 
        <div class="page-ft">
            <span class="fs32 color_w fw_b BGcolor_r postBtn">确认添加</span>
          </div>
      </div>
    

</div>
</form>
{/block}

{block name="footer"}
<script>
	 var img_url = ''

  //选择上传图片
  function uploadFile(_this, e) {
    compress(e, function (base64Img) {
      img_url = base64Img
      $('.userimg').attr('src', base64Img);
    })
  }
$(function(){
	
	$('.postBtn').click(function (){
		var arr = $('#alipay_from').toJson();
		if (arr.alipay_user_name == ''){
			_alert('请输入账户姓名.');
			return false;	
		}
		if (arr.alipay_account == ''){
			_alert('请输入支付宝账号.');
			return false;	
		}
		 if (arr.img_url == '') {
      _alert('请输入上传收款二维码.');
      return false;
    }
	
		jq_ajax('{:url("member/api.withdraw/addAlipay")}',arr,function(res){
			if (res.code == 0){
				_alert(res.msg);
				return false;
			}
			window.location.href = '{:url("withdraw/banklist")}';	
		});	
		
	})
})
</script>
{/block}